Add browser console demo for cMCP#21
Merged
Merged
Conversation
A point-and-click version of the CLI demos for showing on a screen. Sends real tool calls through the gateway, shows Cedar allow/deny live, closes the session into a signed TRACE record, and runs cmcp verify offline. A small stdlib web server serves the UI and proxies to the gateway so the browser never holds the bearer token and there's no CORS to configure. Reuses the shared filesystem MCP server and the same action-dialect Cedar policy as demo-01. Catalog carries definition_hash and a schema-valid fingerprint so it loads on current cmcp-runtime. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| return self._send(404, {"error": "not found"}) | ||
|
|
||
| def _serve_static(self, rel): | ||
| target = (WEB / rel).resolve() |
|
|
||
| def _serve_static(self, rel): | ||
| target = (WEB / rel).resolve() | ||
| if not str(target).startswith(str(WEB.resolve())) or not target.is_file(): |
| target = (WEB / rel).resolve() | ||
| if not str(target).startswith(str(WEB.resolve())) or not target.is_file(): | ||
| return self._send(404, "not found", "text/plain") | ||
| self._send(200, target.read_bytes(), _CT.get(target.suffix, "application/octet-stream")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A browser-based version of the demos, for showing cMCP on a screen instead of a terminal. Lives in
web-console/.Send
write_file/read_file(Cedar permits) andlist_dir(Cedar forbids) and watch the decisions live; close the session into a signedGatewayClaim; verify it offline withcmcp verify. Every value on the page comes from the real gateway.How it works
run.pystarts the shared MCP filesystem server (:9001), the cMCP gateway (:8443,CMCP_DEV_MODE=1), and a small stdlib web server (:8000). The browser talks only to the web server, which proxies to the gateway server-side — so the bearer token stays off the browser and there's no CORS to configure. It uses the same HTTP endpoints as the CLI demos (POST /mcp,GET /audit/export,POST /sessions/{id}/close) and the same action-dialect Cedar policy asdemo-01.Verified locally end to end: allowed call returns 200 and writes the file,
list_dirreturns 403POLICY_DENY, close returns a signed claim (allowed 1 / denied 1), andcmcp verifyreportspartially_verifiedin software-only mode.Note
The catalog here carries
definition_hashand a schema-valid TLS fingerprint so it loads on the currentcmcp-runtimecatalog schema (the older demo catalogs predate that stricter validation — worth a follow-up sweep, not touched here).🤖 Generated with Claude Code